package com.leyou.item.api;

import com.leyou.common.pojo.PageResult;
import com.leyou.item.Bo.SpuBo;
import com.leyou.item.pojo.Sku;
import com.leyou.item.pojo.Spu;
import com.leyou.item.pojo.SpuDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

public interface GoodsApi {


    //根据spuid查询spu 信息
    @GetMapping("/spu/{id}")
    Spu querySpuById(@PathVariable("id") Long id);

    @GetMapping("/spu/page")
//查询分页列表数据
    PageResult<SpuBo> querySpuByPage(@RequestParam(value = "page", defaultValue = "1") Integer page,
                                     @RequestParam(value = "rows", defaultValue = "5") Integer rows,
                                     @RequestParam(value = "key", required = false) String key,
                                     @RequestParam(value = "saleable", required = false) Boolean saleable);

    //根据商品spu的id查询sku列表
    @GetMapping("/sku/list")
    List<Sku> querySkuBySpuId(@RequestParam("id") Long spuId);

    //根据商品sku的id查询商品详情
    @GetMapping("/spu/detail/{id}")
    SpuDetail querySpuDetailById(@PathVariable("id") Long spuId);

    //根据sku的id查询sku
    @GetMapping("/sku/{id}")
    Sku querySkuBySkuId(@PathVariable("id") Long id);

}
